#pragma once

#include "IDigraph.h"
#include <vector>
#include <deque>

class BfsVisitor
{
public :
	BfsVisitor() {};
	virtual ~BfsVisitor() {};
	virtual void initialize(const std::unique_ptr<IDigraph> &graph, int start_vertex) = 0;
	virtual void comeToVertex(int vertex) = 0;
	virtual void processEdge(int from, int to) = 0;
	virtual void leaveVertex(int vertex) = 0;
	virtual void finalize() = 0;
	virtual void preInit() = 0;
};

class BfsFindPath : public BfsVisitor
{
public :
	~BfsFindPath() {}
	void initialize(const std::unique_ptr<IDigraph> &graph, int start_vertex);
	void comeToVertex(int vertex);
	void processEdge(int from, int to);
	void leaveVertex(int vertex);
	void finalize();
	void setTargetVertex(int vertex);
	void preInit();
	std::vector<Edge> getProcessOrder();
	std::vector<int> getResultedPath();
private :
	std::vector<int> _path, _previous;
	std::vector<Edge> _edge_process_order;
	int _target_vertex;
};
